Skip to content

prevent re-initilization of hx-on from process or morph#3830

Open
MichaelWest22 wants to merge 1 commit into
bigskysoftware:four-devfrom
MichaelWest22:hx-on-init-guard
Open

prevent re-initilization of hx-on from process or morph#3830
MichaelWest22 wants to merge 1 commit into
bigskysoftware:four-devfrom
MichaelWest22:hx-on-init-guard

Conversation

@MichaelWest22

@MichaelWest22 MichaelWest22 commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Description

This prevents hx-on listeners being re applied when you morph or process existing nodes. Without this the events can fire multiple times causing confusion.

This does not resolve changing of existing hx-on attributes only preventing the duplication and change issues. This matches how htmx 4 currently handles core hx-trigger actions as well which has a similar guard already.

Corresponding issue:

Testing

Please explain how you tested this change manually, and, if applicable, what new tests you added. If
you're making a change to just the website, you can omit this section.

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

@MichaelWest22 MichaelWest22 added the htmx 4 Issues specific to htmx version 4 label Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

htmx 4 Issues specific to htmx version 4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant